gtkplacessidebar: Fix new tab/window handling for cloud accounts
authorCarlos Soriano <csoriano@gnome.org>
Mon, 30 Oct 2017 20:47:07 +0000 (21:47 +0100)
committerCarlos Soriano <csoriano@gnome.org>
Mon, 13 Nov 2017 15:57:02 +0000 (16:57 +0100)
It wasn't taking into account whether the sidebar had support for them
or not, resulting in a file chooser with open in new tab/window menu
items when it's not supported.

To fix it, do as with the other menus and check for the availability of
new tab/window flags.

https://bugzilla.gnome.org/show_bug.cgi?id=786123

gtk/gtkplacessidebar.c

index 92b380696d2968dc29dfcdd6b48244b014269249..247d1b4d2918d6b62acc311a9b14d59063da8b70 100644 (file)
@@ -3568,14 +3568,18 @@ build_popup_menu_using_gmenu (GtkSidebarRow *row)
       g_menu_item_set_action_and_target_value (item, "row.open",
                                                g_variant_new_int32 (GTK_PLACES_OPEN_NORMAL));
       g_menu_append_item (menu, item);
-      item = g_menu_item_new (_("Open in New _Tab"), "row.open-other");
-      g_menu_item_set_action_and_target_value (item, "row.open-other",
-                                               g_variant_new_int32 (GTK_PLACES_OPEN_NEW_TAB));
-      g_menu_append_item (menu, item);
-      item = g_menu_item_new (_("Open in New _Window"), "row.open-other");
-      g_menu_item_set_action_and_target_value (item, "row.open-other",
-                                               g_variant_new_int32 (GTK_PLACES_OPEN_NEW_WINDOW));
-      g_menu_append_item (menu, item);
+      if (sidebar->open_flags & GTK_PLACES_OPEN_NEW_TAB)
+        {
+          item = g_menu_item_new (_("Open in New _Tab"), "row.open-other");
+          g_menu_item_set_action_and_target_value (item, "row.open-other", g_variant_new_int32(GTK_PLACES_OPEN_NEW_TAB));
+          g_menu_append_item (menu, item);
+        }
+      if (sidebar->open_flags & GTK_PLACES_OPEN_NEW_WINDOW)
+        {
+          item = g_menu_item_new (_("Open in New _Window"), "row.open-other");
+          g_menu_item_set_action_and_target_value (item, "row.open-other", g_variant_new_int32(GTK_PLACES_OPEN_NEW_WINDOW));
+          g_menu_append_item (menu, item);
+        }
       cloud_provider_menu = cloud_providers_account_get_menu_model (cloud_provider_account);
       cloud_provider_action_group = cloud_providers_account_get_action_group (cloud_provider_account);
       if (cloud_provider_menu != NULL && cloud_provider_action_group != NULL)